/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package deatax.display.gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.swing.JPanel;

/**
 *
 * @author nrechten
 */
public class RoundedPanel extends JPanel {

    public static Color TEXT_ACTIVE = new Color(10, 10, 10);
    public static Color TEXT_IDLE = new Color(100, 100, 100);
    public static Color TEXT_SHADOW = new Color(255, 255, 255, 150);
    public static Color GLOSS_TOP = new Color(255, 255, 255, 115);
    public static Color GLOSS_BOTTOM = new Color(255, 255, 255, 75);
    public static Color BG_IDLE = new Color(215, 215, 215);
    public static Color BG_HOVER = new Color(182, 226, 251);
    public static Color BG_ACTIVE = new Color(240, 240, 240);

    public RoundedPanel() {
        setBackground(BG_IDLE);
    }



    @Override
    protected void paintComponent(Graphics g) {
    
        int w = getWidth();
        int h = getHeight();

        int x = 0;
        int y = 0;

        int b = 5;

        Color bg = getBackground();

        Graphics2D g2 = (Graphics2D) g;

        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

        GradientPaint gp = new GradientPaint(0, 0, GLOSS_TOP, 0, 5, GLOSS_BOTTOM);

        g.setColor(bg);
        g2.fillRoundRect(x+1, y+1, w-2, h-2, b * 2, b * 2);

        g2.setPaint(gp);
        g2.fillRoundRect(x+1, y+1, w-2, h / 2, b * 2, b * 2);
        g2.fillRoundRect(x+1, y+1, w-2, h-2 , b * 2, b * 2);


        g2.setColor(new Color(160, 160, 160));
        g2.drawRoundRect(x, y, w-1, h-1, b * 2, b * 2);

        g.setColor(Color.WHITE);
        g2.drawRoundRect(x+1, y+1, w-3, h-3, b * 2, b * 2);


    }

}
